home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / forthcmp.zip / READ.ME < prev    next >
Text File  |  1992-03-30  |  12KB  |  281 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                       
  10.                                 What is ForthCMP?
  11.  
  12.  
  13.      ForthCMP is the Forth language compiler for computers running MS-DOS.
  14.      Features of ForthCMP:
  15.  
  16.      ∙    Compiles Forth into machine code -- not interpreted.
  17.  
  18.      ∙    ForthCMP is written in Forth so that Forth code can be executed
  19.           during compilation, as is customary in Forth applications.
  20.  
  21.      ∙    Very fast -- ForthCMP compiles Forth code into an executable file
  22.           in a single pass. 
  23.  
  24.      ∙    Generated code is extremely compact. Over 100 Forth "primitives"
  25.           are compiled in-line. ForthCMP performs constant expression
  26.           folding, strength reduction, register optimization, DO...LOOP
  27.           optimization, tail recursion, and various "peephole"
  28.           optimizations.
  29.  
  30.      ∙    Built-in assembler.
  31.  
  32.      ∙    Libraries are in source format.
  33.  
  34.      ∙    ForthCMP supports many memory models, none big, but several not 
  35.           often found in compilers:
  36.           °    Single segment COM file, fixed at 64k bytes
  37.           °    As above, but minimized segment size for TSRs
  38.           °    Separate code and data segment EXE file
  39.           °    Device driver SYS format
  40.           °    Romable program, uninitialized ram
  41.           °    Romable program, data ram initialized from rom image 
  42.           °    Any of the above can have a separate stack segment for
  43.                return and parameter stacks
  44.  
  45.      ∙    Functions exist for allocating memory in additional segments, or
  46.           allocating arrays on the stack, to handle programs with large
  47.           data memory requirements.
  48.  
  49.      ∙    Library support:
  50.           °    The 83 Forth standard, except for functions that do not make
  51.                sense in a compiled environment.
  52.           °    Many additional words that are non-standard but widely
  53.                accepted, such as SKIP SCAN NIP and TUCK.
  54.           °    Direct Display Writing library for fast display of text in 
  55.                color, and positioned on screen.  For IBM-PC compatibles.
  56.           °    Multitasker with message passing facility and timed sleeps.
  57.           °    Library to support writing "Filter" programs.
  58.           °    MS-DOS file interface, compatible with LMI Forths.
  59.           °    String support, compatible with LMI Forths.
  60.           °    Forth Vendor standard software floating point (for customers
  61.                of LMI Forth).
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                              The History of ForthCMP
  70.  
  71.      ForthCMP started as a project to selectively compile colon definitions
  72.      as code words in figForth back in 1982. I bundled this Native Code
  73.      Compiler with a Z-80 (tm Zilog) fig Forth I sold for embedded system
  74.      use at that time. Ray Duncan of Laboratory Microsystems was interested
  75.      in this product, and I ported it to LMI's Z-80 Forth for sale with his
  76.      Forth environment.
  77.  
  78.      The Native Code Compiler was translated to the 8088 processor, and
  79.      more recently to the 80386. It still comes bundled with LMI's Forth
  80.      products.
  81.  
  82.      In 1984 I became interested in the idea of a Forth compiler that would
  83.      compile entire applications into machine code rather than selected
  84.      colon definitions. Such a compiler would be capable of many additional
  85.      optimizations not available in a mixed system. Thus CFORTH, as it was
  86.      called, was born. The original version was for the Z-80, but a
  87.      Microsoft MS-DOS version was soon to follow. Laboratory Microsystems
  88.      sold CFORTH until roughly 1987 when it was removed from their catalog.
  89.      My feeling was that CFORTH simply wasn't understood, and that the wide
  90.      distribution of the reincarnated version, ForthCMP will have greater
  91.      acceptance.
  92.  
  93.      I renamed the compiler to avoid confusion with C-Forth (Forth in C)
  94.      that has been available for the past few years.
  95.  
  96.      ForthCMP does have a few changes from the CFORTH predecessor. Unlike
  97.      other compilers which seem to make application size grow with each new
  98.      release, ForthCMP programs take less memory than they did when
  99.      compiled with CFORTH. The startup code has been enhanced, and I've
  100.      added new optimizations for several common situations. I also made
  101.      changes to make ForthCMP run in Microsoft Windows, and under DOS 5.0.
  102.      I improved the way romable applications can be built, and added a new
  103.      memory model to allow creation of DOS device drivers (SYS files). In
  104.      total, I have devoted over 100 hours of effort into improving
  105.      ForthCMP.
  106.  
  107.      When CFORTH was sold, it ran faster than C compilers, and created
  108.      executables that were far smaller and faster. C compiler technology is
  109.      catching up; for instance the most recent versions of Microsoft and
  110.      Borland Cs allow passing arguments in registers, something that CFORTH
  111.      did back in 1984. But the C compilers have gotten much bigger and
  112.      slower over the years. ForthCMP still runs fine on a machine without a
  113.      hard disk. The compiler is only about 32k bytes long.
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.                              ForthCMP is "Shareware"
  122.  
  123.      Forth is one of very few programming languages whose adherents tend to
  124.      feel that their compilers should be free. Unfortunately this has
  125.      doomed the language to a second rate status because nobody can make a
  126.      living selling Forth tools. I have realized that myself, having only
  127.      made enough money to pay for my computer systems over the years with
  128.      Forth.
  129.  
  130.      There does seem to be quite a market for Forth books and manuals, as
  131.      all of this free software does seem to be rather poorly documented. I
  132.      am taking a novel approach in distributing ForthCMP. This archive file
  133.      contains all ForthCMP libraries (with one exception -- software
  134.      floating point) and all demo programs. But there is no documentation!
  135.      Also some files used for compatibility with LMI Forths have been
  136.      omitted.
  137.  
  138.      To evaluate ForthCMP, place all the files in one directory and compile
  139.      some of the sample programs. The program DEMO.4TH is well enough
  140.      documented to give you a good start in writing your own ForthCMP
  141.      programs. Use DEBUG to examine the generated code -- you will find it
  142.      is quite good, often combining sequences of Forth primitives into a
  143.      single machine instruction.
  144.  
  145.      If you like what you see, you can register your copy of ForthCMP and
  146.      obtain the users' manual (113 page, 28,500 word, laser printed) and a
  147.      disk with the latest version for $50.00. Send a personal check or
  148.      money order; I do not accept COD orders or credit cards, but I do ship
  149.      quickly without waiting for checks to clear. Customers outside the US
  150.      please remit in US funds $60.00 to cover the additional shipping
  151.      costs. Please specify floppy disk size and capacity.
  152.  
  153.      I'm a hungry guy, so please register within 30 days. I won't be
  154.      pleased if you distribute an application using ForthCMP without first
  155.      registering. (It's also a copyright violation).
  156.  
  157.      If you own a copy of any Laboratory Microsystems (LMI) Forth with
  158.      software floating point, send a photocopy of the first page of the
  159.      software floating point section of the manual with your order and
  160.      receive a disk containing software floating point for ForthCMP at no
  161.      additional charge.
  162.  
  163.      Mail your order to:
  164.  
  165.           Tom Almy
  166.           17830 SW Shasta Trail
  167.           Tualatin, OR  97062
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.                                 ForthCMP's Future
  176.  
  177.      I've had several ideas in the wings these past few years. If ForthCMP
  178.      is a success this year (1992), I will probably produce a new version.
  179.      Most of these concepts are tried; it is just a matter of tying them
  180.      together:
  181.  
  182.      ∙    Change in underlying Forth, and better use of memory, will give a
  183.           20% or better speed improvement while increasing the compiler
  184.           capacity.
  185.      ∙    A simple macro facility
  186.      ∙    Intrinsic dynamically allocated arrays
  187.      ∙    80x87 floating point support (this is a very fast and accurate
  188.           implementation).
  189.      ∙    Improved optimization of return stack and registers
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.                                 Distributed Files
  198.  
  199.      Here is a brief description of the distribution files:
  200.  
  201.      The heart of the matter:
  202.      4c.ico              Icon for Microsoft Windows 3.x
  203.      4c.pif              PIF file for Microsoft Windows 3.x
  204.      readme.doc          This file
  205.      4c.com              The compiler executable
  206.  
  207.      Library files:
  208.  
  209.      display1.4th        Fast direct display output
  210.      display2.4th         Second part of above
  211.      dos1.4th            File I/O
  212.      dos2.4th             Second part of above
  213.      dosgo.scr           Initialization code, COM format
  214.      exec.4th            EXEC function (DOS shell)
  215.      exego.scr           Initialization code, EXE format
  216.      farmem1.4th         "Far" memory allocation
  217.      farmem2.4th          Second part of above
  218.      filter.4th          Used to write "filter" type programs
  219.      forthlib.scr        Basic library
  220.      ints.4th            Used for writing interrupt handlers
  221.      multi.4th           Multitasker
  222.      multid.4th          Multitasker with direct display output
  223.      romgo.4th           Example initialization code, ROM format
  224.      strings1.4th        String functions
  225.      strings2.4th         Second part of above
  226.      vars.4th            83 Standard variables
  227.  
  228.      Demo and utility programs:
  229.  
  230.      bytebnch.4th        The old Byte Magazine sieve benchmark
  231.      copies.4th          Merges screen files
  232.      defining.4th        Examples of defining word usage
  233.      demo.4th            Generic Demo -- read this first
  234.      driver.4th          Example device driver
  235.      enscreen.4th        Convert ASCII to screen file
  236.      ffind.4th           Search for string in screen files
  237.      find.4th            Search for string in ASCII files
  238.      hanoi.4th           Tower of Hanoi Puzzle
  239.      hanoimt.4th         Multitasking Tower of Hanoi (read before
  240.                          compiling)
  241.      iagebnch.4th        Interface Age Magazine benchmark
  242.      index.4th           List first line of each screen in screen file
  243.      interupt.4th        Example of interrupt handling
  244.      kbdr.4th            Example TSR to exchange CapsLock and Ctrl keys
  245.      life.4th            Conway's Life
  246.      list.4th            List a screen file
  247.      queens.4th          Solves Eight Queens puzzle
  248.      scrdif.4th          Compares two screen files
  249.      tail.4th            List first/last n lines/characters of a file
  250.      tr.4th              Translate characters in a file
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.      uniq.4th            Find/delete duplicate lines in a file
  259.      unload.4th          Convert COM to HEX format
  260.      unscreen.4th        Convert screen file to ASCII file
  261.      wc.4th              Count words/lines/pages in a file
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.                                 Limited Warranty
  270.  
  271.      When registered, Thomas Almy warrants the floppy disk and manual to be
  272.      free of defects in material and workmanship for 90 days from date of
  273.      shipment.
  274.  
  275.      Thomas Almy makes no warranty, either expressed or implied, with
  276.      respect to the use of ForthCMP or any of the utility and demo programs
  277.      supplied. You, the user, are expected to evaluate the software for
  278.      appropriateness before registration. Thomas Almy is under no
  279.      circumstances liable for consequential damages or related expenses. In
  280.      any case liability is limited to the registration cost of ForthCMP.
  281.